home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group00b.txt / 000019_icon-group-sender _Wed Jul 12 16:28:16 2000.msg < prev    next >
Internet Message Format  |  2001-01-03  |  3KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.9.1a/8.9.1) id QAA26521
  4.     for icon-group-addresses; Wed, 12 Jul 2000 16:26:12 -0700 (MST)
  5. Message-Id: <200007122326.QAA26521@baskerville.CS.Arizona.EDU>
  6. From: "F.G. van DORP" <F.G.van.Dorp@digimedia.nl>
  7. X-Newsgroups: comp.lang.icon
  8. Subject: Re: Error messages
  9. X-Newsreader: Forte Agent 1.7/32.534
  10. Date: Wed, 12 Jul 2000 20:00:41 GMT
  11. X-Complaints-To: abuse@chello.nl
  12. X-Trace: flipper 963432041 212.187.67.243 (Wed, 12 Jul 2000 22:00:41 MET DST)
  13. To: icon-group@optima.CS.Arizona.EDU
  14. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  15. Status: RO
  16. Content-Length: 2695
  17.  
  18. On 10 Jul 2000 19:25:27 -0400, Taybin Rutkin <trutkin@black.clarku.edu> wrote:
  19.  
  20. >On Mon, 10 Jul 2000, Alexandre E. Kopilovitch wrote:
  21. >
  22. >> "Richard A. O'Keefe" <ok@atlas.otago.ac.nz> wrote:
  23. >
  24. >> 1. Notation matters.
  25. >> 
  26. >> Suppose that you have to show your Icon program to another person that have
  27. >> no slightest idea about the Icon and Snobol. Surely you will have serious
  28. >
  29. >I think that the paradigm shift from procedural to logical is made easier
  30. >with Icon.  The syntax is (and here I'm assuming that you mean operaters
  31. >and keywords and their respective order) much more familiar than
  32. >prolog.  I found prolog to be this bizarre alien creature.  It was really
  33. >out of my world...
  34. >
  35. >Taybin Rutkin -- trutkin@black.clarku.edu
  36.  
  37. Actually Prolog is much more similar to Icon than one would suspect:
  38.  
  39. PROLOG
  40.   pred1(P1,P2,P3,R1)   :-   pred2(P1,P2,R2), pred3(P3,R2,R1).
  41.  
  42.  
  43. ICON
  44. procedure pred1(P1,P2,P3)
  45.                return (R2:=pred2(P1,P2)   &  R1:=pred3(P3,R2))
  46. end
  47.  
  48. This Icon return-expression is a backtracking context and known as
  49. "mutual evaluation" or a "compound conjunction" (and *NOT* a
  50. "compound expression" as I erroneously wrote in one of my previous
  51. postings. Quite the contrary: such expressions, seperated from each
  52. other by semicolons  (sometimes implicated, see manual), will not
  53. get resumed if the next in line fails. So the semicolon acts as a "fence"
  54. to backtracking).  
  55. The difference between Icon and Prolog lies in the nature of the
  56. procedure/predicate parameters (the P's; R's are the return values).
  57. In Icon these must have a value other than the default NULL value
  58. or else  an error message will be generated. In Prolog a parameter
  59. variable can have a value when passed or not, the so-called  
  60. "logical variable".  An example:
  61.  
  62.         addlist(List1,List2,Newlist)
  63.  
  64. If  List1 and List2 have values  when  addlist is called, Newlist
  65. returns the sum of List1 and List2. When called with
  66. Newlist and either List1 or List2 with values, addlist returns
  67. the difference list. When called with only Newlist valued,
  68. addlist can generate (through backtracking) all sublist pairs
  69. of Newlist.
  70. There are functional languages with the power of the logical variable,
  71. implemented through a mechanism called "narrowing" (similar to
  72. Prolog's unification). One such language is CURRY
  73.         http://www.informatik.uni-kiel.de/~curry/
  74. I doubt if this behavior could be coded in Icon, or even added
  75. to its implementation, should one wish to do so.
  76. Another way is to add a Prolog engine to your program with
  77. an interface to your Icon code,
  78. as mr.LaPalme (lapalme@IRO.UMontreal.CA) managed to do
  79. a while back (see Icon archives).
  80. =====================================================
  81.  
  82.